# -*- coding:utf8 -*-

"""first example of twisted"""

import os
import sys
from twisted.internet import protocol, reactor


class Echo(protocol.Protocol):
    def dataReceived(self, data):
        print data
        self.transport.write(data)

class EchoFactory(protocol.Factory):
    def buildProtocol(self, addr):
        return Echo()


reactor.listenTCP(8000, EchoFactory())
reactor.run()
